package com.stone.im.sdk.controller;

import com.stone.im.common.Constants;
import com.stone.im.common.Request;
import com.stone.im.protobuf.proto.MessageSendRequestProto;

public class MessageController {

    /**
     * 发送单挑消息
     * @param senderId
     * @param receiverId
     * @param content
     */
    public void sendMessage(String senderId,String receiverId,String content){
        MessageSendRequestProto.MessageSendRequest.Builder builder =
                MessageSendRequestProto.MessageSendRequest.newBuilder();

        builder.setContent(content);
        builder.setSenderId(senderId);
        builder.setReceiverId(receiverId);

        MessageSendRequestProto.MessageSendRequest messageSendRequest = builder.build();

        Request request = new Request(
                Constants.APP_SDK_VERSION_1,
                Constants.REQUEST_TYPE_SEND_MESSAGE,
                Constants.SEQUENCE_DEFAULT,
                messageSendRequest.toByteArray()
        );
        System.out.println("客户端向接入系统发送一条单聊消息");
    }
}
